<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/corp/include/taglibs.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>电子杂志管理</title>
	<LINK href="${ctx }/css/style.css" type=text/css rel=stylesheet>
	<LINK href="${ctx }/css/corp/css.css" type=text/css rel=stylesheet>
	<!-- wrongimage指错误时显示的图片 rightimage指正确时显示的图片 wordcolor指显示的字体颜色 function指生成的调用函数名  callfuntionaname指调用DWR的函数名-->
	<!-- 验证网址-->
	<mytag:validatewebsite wrongimage="${ctx }/images/corp/note_error.gif"
		rightimage="${ctx }/images/corp/note_ok.gif" wordcolor="red"
		rightwordcolor="green" submitvalidate="true"></mytag:validatewebsite>

	<!-- 验证数字 -->
	<mytag:validatedigital wrongimage="${ctx }/images/corp/note_error.gif"
		rightimage="${ctx }/images/corp/note_ok.gif" wordcolor="red"
		rightwordcolor="green" submitvalidate="true"></mytag:validatedigital>

	<!-- 提交验证 -->  
	<mytag:validatesubmit wrongimage="${ctx }/images/corp/note_error.gif"
		submitform="publicationForm" wordcolor="red" initstr="标题,封面图,封底图">
	</mytag:validatesubmit>

	<mytag:validateemptylendisplay
		wrongimage="${ctx }/images/corp/note_error.gif"
		rightimage="${ctx }/images/corp/note_ok.gif" wordcolor="red"
		rightwordcolor="green" submitvalidate="true">
	</mytag:validateemptylendisplay>
	<mytag:validateemptylendisplay
		wrongimage="${ctx }/images/corp/note_error.gif"
		rightimage="${ctx }/images/corp/note_ok.gif" wordcolor="red"
		rightwordcolor="green" submitvalidate="true"></mytag:validateemptylendisplay>


	<style type="text/css">
	<!--	

p{padding-bottom:1em}
div#Layer2{
	margin:10 5%;
	background-color: #CCF3FD;
	position:absolute;
	left:550px;
	top:154px;
	width:200px;
	
	
}

b.rtop, b.rbottom{display:block;background: #FFF}
b.rtop b, b.rbottom b{display:block;height: 1px;
    overflow: hidden; background: #CCF3FD}
b.r1{margin: 0 5px}
b.r2{margin: 0 3px}
b.r3{margin: 0 2px}
b.rtop b.r4, b.rbottom b.r4{margin: 0 1px;height: 2px}


#Layer1 {
	position:absolute;
	left:86px;
	top:35px;
	width:23px;
	height:23px;
	z-index:1;
	font-weight:600;
	font-size:12px;
	
}
.hightsethidden{
display:none;
}
.hightsetdisplay{ 
display:block;
}

#Layer3 {
	position:absolute;
	left:648px;
	top:457px;
	width:230px;
	height:235px;
	z-index:3;
}

#bgdhidden{
width:75px;
	height:28px;
}
.inputFocus {
	BACKGROUND: #cf9;
}
#insertimgdisplay{
display:block;
height:90;
width:80;
border:none;
}
#insertimghidden{
display:none;
}
.setposition{
position

}
.STYLE5 {color: #FF0000}

	-->
	</style>

	<script language="javascript"> 
	
//改变高级选项显示
function getintohightset(){
//alert(document.getElementById("getintohightset").checked);
 if(document.getElementById("getintohightset").checked)
 hightset.className='hightsetdisplay';
 else 
 hightset.className='hightsethidden';
}
//当获得焦点的时候








window.document.onfocusin=function(){
var obj = event.srcElement ? event.srcElement : event.target;
if (obj.id=="getintohightset") 
getintohightset();

if(obj.tagName.toLowerCase()=="input"&&(document.getElementsByName(obj.name)[0].type=="text"||document.getElementsByName(obj.name)[0].type=="password")){
 document.getElementsByName(obj.name)[0].className="inputFocus";
}
else if(obj.tagName.toLowerCase()=="textarea"||obj.tagName.toLowerCase()=="select")
document.getElementsByName(obj.name)[0].className="inputFocus";
	
}
//当焦点移除的时候








window.document.onfocusout=function(){
var obj = event.srcElement ? event.srcElement : event.target;
/*********控制颜色*******/
 if(obj.tagName.toLowerCase()=="input"&&(document.getElementsByName(obj.name)[0].type=="text"||document.getElementsByName(obj.name)[0].type=="password"))
 document.getElementsByName(obj.name)[0].className="";
 else if(obj.tagName.toLowerCase()=="textarea"||obj.tagName.toLowerCase()=="select")
document.getElementsByName(obj.name)[0].className="";
}
function controlimag(name,disimgname){
  /*********控制上传图像************/ 
    // alert(name);
     var getname=document.getElementsByName(name)[0];
      
     
     if(getname.value!="")
       {     
       
       if(disimgname=="nsPlayer") document.getElementsByName(disimgname)[0].id="bgdhidden";
       else document.getElementsByName(disimgname)[0].id="insertimgdisplay";
       // alert(getname.value);
        if(disimgname=="nsPlayer")  document.getElementsByName(disimgname)[0].FileName=getname.value;
        else
          document.getElementsByName(disimgname)[0].src=getname.value;   
       document.getElementsByName(name)[0].size=30;  
	    
       }
       else  {
       document.getElementsByName(disimgname)[0].id="insertimghidden";
             document.getElementsByName(name)[0].size=50;}   
 
}
/*获得后缀名*/
function getsuffixname(name){
var cfilename =document.getElementsByName(name)[0].value;
return cfilename.substring(cfilename.lastIndexOf('.') + 1);
}
//获得图片的高度和宽度
function getwdhg(name,spanname,imagspanname,realname)
{

  if(document.getElementsByName(name)[0].value!=""){
	
	var image=new Image();  
	image.onload=function(){
	}
    image.src=document.getElementsByName(name)[0].value;
	
	  if(checkpubtype()==1){	
	    if(image.width==0) return false;
	    else if(image.width<=1010&&image.width>=990){
	     emptyelement(realname);
	     return true;
	    }
	    else
	    {
	    message="<font color=\"red\">对不起,图片高度和宽度大小不正确！</font>";
	      url="<img src=\"${ctx }/images/corp/note_error.gif\"/>";
	       document.getElementById(spanname).innerHTML=url+message;  
	      document.getElementsByName(imagspanname)[0].id="insertimghidden"; 
	      document.getElementsByName(name)[0].size=50;
	      pluselement(realname);
	      return false;   
	    
	     }
	  }
	 else if(checkpubtype()==2){ 
	   image.src=document.getElementsByName(name)[0].value;
	    if(image.width==0) return false;
	   else if(image.width<=2010&&image.width>=1990){
	     emptyelement(realname);
	    return true;
	    }
	    else
	    {
	     message="<font color=\"red\">对不起,图片高度和宽度大小不正确！</font>";
	      url="<img src=\"${ctx }/images/corp/note_error.gif\"/>";
	      document.getElementById(spanname).innerHTML=url+message;  
	      document.getElementsByName(imagspanname)[0].id="insertimghidden"; 
	      document.getElementsByName(name)[0].size=50;
	      pluselement(realname);
	      return false;
	    
	    
	    }
	 }
	 image=null;
 }	 
}
//判断用户所选电子书类型(1单页，2双页)
function checkpubtype(){
 var pubtype= document.getElementsByName("publication.pubtype");
 if(pubtype[0].checked==true) return pubtype[0].value;
 else if(pubtype[1].checked==true)  return pubtype[1].value

}
//判断后缀名(封面图，封底图，背景图)
function checksuffixname(name,spanname,imagspanname,realname){
if(document.getElementsByName(name)[0].value!=""){
var str=new Array("jpg","jpeg");
var realsuffixname=getsuffixname(name);
var flag=0;
//alert(realsuffixname);
for(var i=0;i<str.length;i++){
 if(str[i]==realsuffixname.toLowerCase()){
   flag=1; break;
 }
 }
 //alert(flag);   
 if(flag==0){
  document.getElementsByName(name)[0].value="";
  message="<font color=\"red\">对不起,格式不正确！</font>";
  url="<img src=\"${ctx }/images/corp/note_error.gif\"/>";
  document.getElementById(spanname).innerHTML=url+message; 
   pluselement(realname);
  return false;
 }else{
   document.getElementsByName(name)[0].value="";
  message="<font color=\"green\">恭喜,格式正确！</font>";
  url="<img src=\"${ctx }/images/corp/note_ok.gif\"/>";
  document.getElementById(spanname).innerHTML=url+message;  
  // document.getElementsByName(imagspanname)[0].id="insertimghidden"; 
  // document.getElementsByName(name)[0].size=50;
   emptyelement(realname);
  return true; 
 } 

   
 } 

}
//当选择电子书类型时（1单页 2双页）






window.document.onclick=function (){
var obj = event.srcElement ? event.srcElement : event.target;

if(obj.name=="publication.pubtype")
{
 if(checksuffixname('thumb','thumbmessage','thumbimg','封面图'))
 validateemptylendisplay(document.getElementsByName("thumb")[0].value,1,200,'thumbmessage','封面图')
  if(checksuffixname('endpicture','endpictureimgmessage','endpictureimg','封底图'))
  validateemptylendisplay(document.getElementsByName("endpicture")[0].value,1,200,'endpictureimgmessage','封底图')
 }
}
function checkbackgroudsound(name,spanname,imagspanname,realname){
if(document.getElementsByName(name)[0].value!=""){
var str=new Array("mp3","MP3");
var realsuffixname=getsuffixname(name);
var flag=0;
//alert(realsuffixname);
for(var i=0;i<str.length;i++){
 if(str[i]==realsuffixname){
   flag=1; break;
 }
 }
 //alert(flag);
 if(flag==0){
  document.getElementsByName(name)[0].value="";
  message="<font color=\"red\">对不起,格式不正确！</font>";
  url="<img src=\"${ctx }/images/corp/note_error.gif\"/>";
  document.getElementById(spanname).innerHTML=url+message;  
   document.getElementsByName(imagspanname)[0].id="insertimghidden"; 
   document.getElementsByName(name)[0].size=50;
   document.getElementsByName(imagspanname)[0].FileName="";
   pluselement(realname);
  return false;
 }
  else {  
      controlimag(name,imagspanname);  
      emptyelement(realname);
      return true;
   }
   
 } 
 else{
// message="<font color=\"red\">对不起,"+realname+"不能为空！</font>";
 // url="<img src=\"${ctx }/images/corp/note_error.gif\"/>";
//  document.getElementById(spanname).innerHTML=url+message;  
 }

}
/*当窗体滚动时发生*/

function scrollchange(){
//alert(document.getElementById("Layer2").style.top);
 document.getElementById("Layer2").style.top=154+document.body.scrollTop;
}
//控制图片放大显示
function showpic(src){
   document.getElementById("Layer2").style.display="block";
   document.getElementById("Layer2").style.top=event.clientY+document.body.scrollTop-80;
   document.getElementById("Layer2").style.left=event.clientX+document.body.scrollLeft+30;
   document.getElementById("Layer2").style.width=360;
   document.getElementById("Layer2").style.height=260;
   var str="<table border=\"1\" bordercolor=\"#666666\"><tr><td><img src=\""+src+"\" height=\"260\" width=\"360\"></td></tr></table>";
   document.getElementById("Layer2").innerHTML=str;
}
function closelayer(flag){
  document.getElementById("Layer2").style.display="none";
  document.body.scroll="auto";
  }
</script>
</head>
<div id="Layer2" style="display:none">
	<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b
		class="r4"></b> </b>

	<p>
		<strong>注：</strong><span id="layer2message">请填写左侧相关信息,*号为必填</span>
	</p>
	<p>&nbsp;
		

	</p>
	<p>&nbsp;
		

	</p>
	<p>&nbsp;
		

	</p>

	<b class="rbottom"><b class="r4"></b><b class="r3"></b><b
		class="r2"></b><b class="r1"></b> </b>
</div>


<body onscroll="scrollchange()" >
	<DIV>
	<s:form action="/corp/corpPublication_add.do" name="publicationForm" enctype="multipart/form-data">
	
			<input type="hidden" name="rightid" value="${publication.id}"/>
			<input type="hidden" name="controlCode" value="空间大小"/>	
			<TABLE cellSpacing=6 cellPadding=1 width="90%" border=1>
				<TBODY>
					<TR>
						<TD class=pic1wblue vAlign=top align=left bgColor=#ffffff>
							<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
								<TBODY>

									<TR>
										<TD>

											<TABLE class=tableBorder1 style="WIDTH: 100%" cellSpacing=3
												cellPadding=3>
													<TR>
														<TD style="WIDTH: 100%">
															<table style="WIDTH: 100%" cellspacing=3 cellpadding=3>
																<tbody>
																	<tr>
																		<td width="144">
																			<strong>基本信息</strong>&nbsp;&nbsp;&nbsp;																		</td>
																		<td width="744" align="center">
																			<span id="submitmessage" /><font
																					color="red"></font> <span
																					id="testtxt" />																		</td>
																	</tr>
																	
																	<tr>
																		<td colspan="2">
																			<hr />																		</td>
																	</tr>
																	<tr>
																		<td align=right valign=top style="WIDTH: 130px">
																			<span class="STYLE5">*</span>企业行业：																		</td>
																		<td>
																		<select name="typeId">
																  		<option value="">==请选择==</option>
																		<c:forEach var="corpCatalog" items="${corpCatalogs}">  		
																  				<option value="${corpCatalog.id}">${corpCatalog.catalogName }</option>		
																  		</c:forEach>
																  		</select>
																			&nbsp;&nbsp;&nbsp;
																			<span style=" position:relative; top:-5"><span
																				class="STYLE5">*</span>出版物类型：</span>
																			<select name="pubType">
																	  		<option value="">==请选择==</option>
																			<c:forEach var="typeDict" items="${typeDicts}">  		
																	  				<option value="${typeDict.classCode }">${typeDict.classValue}</option>		
																	  		</c:forEach>
																	  		</select></td>
																	</tr>
																	<tr>
																		<td style="WIDTH: 130px" align=right>
																			<span class="STYLE5">*</span>标题：																		</td>
																		<td colspan="3">
																		<input name="title" type="text" class="username" size="50" maxlength="50" value="${requestScope.publication.title}" onblur="validateemptylendisplay(this.value,1,160,'titlemessage','标题')"/>
																																			<span id="titlemessage" />																		</td>
																	</tr>
																	<tr>
																	  <td style="WIDTH: 130px" align=right>&nbsp;</td>
																	  <td colspan="3" valign="bottom">
																	  <table border="0">
  <tr>
    <td width="110" height="77" valign="top"><img src="${ctx}/images/corp/singlesmall.jpg" onMouseOut="closelayer(false);"
														onmouseover="showpic('${ctx}/images/corp/singlebig.jpg');"/></td>
    
    <td width="98" valign="top"><img src="${ctx}/images/corp/doublesmall.jpg" onMouseOut="closelayer(false);"
														onmouseover="showpic('${ctx}/images/corp/doublebig.jpg');"/></td>
														<td width="98" valign="bottom" style="font-size:13px;color:#FF0000">&nbsp;&nbsp;<a href="${ctx}/corp/publication/qa.jsp" target="_blank"><img src="${ctx }/images/corp/ana.jpg"
																					width="98" height="25" border="0" /></a>&nbsp;</td>
  </tr>
</table>

																	  </td>
																  </tr>
																	<tr>
																		<td style="WIDTH: 130px" align=right>
																			<span class="STYLE5">*</span>电子书类型：																		</td>
																		<td colspan="3" valign="bottom">
																		<input type="radio" id="pubtype" name="pubtype" value="1"
																				checked="checked">
																			单页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																			<input type="radio" id="pubtype" name="pubtype" value="2">双页</td>
																	</tr>
																	<tr>
																		<td style="WIDTH: 130px" align=right>
																			<span class="STYLE5">*</span>封面图：																		</td>
																		<td colspan="3" valign="bottom">
																			<input type="file" name="thumb" id="thumb" onchange="checksuffixname(this.name,'thumbmessage','thumbimg','封面图')"
																				onkeydown="return false" />
																			<span id="thumbmessage" />																		</td>
																	</tr>
																	<tr>
																		<td style="WIDTH: 130px" align=right>
																			<span class="STYLE5">*</span>封底图：																		</td>
																		<td colspan="3" valign="bottom">
																			<input type="file" name="endpicture" id="endpicture" onchange="checksuffixname(this.name,'endpictureimgmessage','endpictureimg','封底图')"
																				onkeydown="return false" />
																			<span id="endpictureimgmessage" />																		</td>
																	</tr>																													
																	
																</tbody>
															</table>
														</TD>
													</TR>												
													<TR>

														<TD colspan="2" align=center>
															<TABLE style="WIDTH: 100%" cellSpacing=3 cellPadding=3>

																<TR>
																	<TD style="WIDTH: 130px" align=right>&nbsp;
																		

																	</TD>
																	<TD align=left>
																		&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;
																		&nbsp;
																		<input type="button" name="submitbutton" class=""
																			onClick="checksubmit('submitmessage');scroll(0,0);"
																			style="cursor:hand" value="确认提交内容" />
																		&nbsp;&nbsp;&nbsp;&nbsp;
																		<input type="button" value=" 返 回 " name="backbutton"
																			class="" onClick="javascript:history.go(-1);"
																			style="cursor:hand" />
																	</TD>
																</TR>
																<TR>
																	<TD colspan="2">
																		<hr />
																	</TD>
																</TR>
															</TABLE>
														</TD>
													</TR>
													<TR>
														<TD style="WIDTH: 130px" align=right></TD>
														<TD></TD>
													</TR>
												</TBODY>
											</TABLE>
										</TD>
									</TR>

									<TR>
										<TD style="WIDTH: 660px"></TD>
									</TR>
								</TBODY>
							</TABLE>
						</TD>
					</TR>
				</TBODY>
			</TABLE>
			</TD>
			</TR>
			</TBODY>
			</TABLE>
	</DIV>
	</s:form>
</body>
</html>